package com.rockcent.mall.lib.helper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

/**
 * Created by Marco on 16-11-14.
 */
@Component
public class MallCertifyInfoHelper {

    private static Logger log = LoggerFactory.getLogger(MallCertifyInfoHelper.class);

    private static final String EMAIL_PATTERN = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
    private static final Pattern EMAIL_REG = Pattern.compile(EMAIL_PATTERN);

    /**
     * 邮箱验证
     * @param email email
     * @return
     */
    public static boolean isEmail(String email){
        if(org.apache.commons.lang3.StringUtils.isBlank(email)){
            return false;
        }
        boolean isEmail = EMAIL_REG.matcher(email).matches();
        return isEmail;
    }

}

